package krow.dev.contest.controller;

import java.util.ArrayList;
import java.util.List;

import krow.dev.contest.Constants.Category;
import krow.dev.contest.R;
import krow.dev.contest.model.SubcategoryItem;
import android.content.Context;

public class SubcategoryFactory {
	
	private Context mContext;
	
	private List<SubcategoryItem> mSubcategoryItemList;

	private String mCategory;
	
	public SubcategoryFactory(Context context) {
	
		mContext = context;
	}
	
	public List<SubcategoryItem> createCategoryList(String category){
		if(category == null){
			return null;
		}
		
		mSubcategoryItemList = new ArrayList<SubcategoryItem>();
		
		mCategory = category;
		
		if(category.equals(Category.DEPARTMENT)){
			addMenu(R.string.department_0101, 
					"01");
			addMenu(R.string.department_0102, 
					"02");
			addMenu(R.string.department_0103, 
					"03");
			addMenu(R.string.department_0105, 
					"05");
			addMenu(R.string.department_0106, 
					"06");
			addMenu(R.string.department_0107, 
					"07");
			addMenu(R.string.department_0109, 
					"09");
			addMenu(R.string.department_0111, 
					"11");
			addMenu(R.string.department_0113, 
					"13");
			addMenu(R.string.department_0114, 
					"14");
			addMenu(R.string.department_0115, 
					"15");
			addMenu(R.string.department_0116, 
					"16");
			addMenu(R.string.department_0120, 
					"20");
			addMenu(R.string.department_0150, 
					"50");
			addMenu(R.string.department_0180, 
					"80");
		}else if(category.equals(Category.ENTERPRISE)){
			addMenu(R.string.enterprise_0201, 
					"01");
			addMenu(R.string.enterprise_0202, 
					"02");
			addMenu(R.string.enterprise_0203, 
					"03");
			addMenu(R.string.enterprise_0204, 
					"04");
			addMenu(R.string.enterprise_0205, 
					"05");
			addMenu(R.string.enterprise_0206, 
					"06");
			addMenu(R.string.enterprise_0208, 
					"08");
			addMenu(R.string.enterprise_0209, 
					"09");
			addMenu(R.string.enterprise_0210, 
					"10");
			addMenu(R.string.enterprise_0211, 
					"11");
			addMenu(R.string.enterprise_0212, 
					"12");
		}else if(category.equals(Category.TARGET)){
			addMenu(R.string.target_0301, 
					"01");
			addMenu(R.string.target_0302, 
					"02");
			addMenu(R.string.target_0303, 
					"03");
			addMenu(R.string.target_0305, 
					"05");
			addMenu(R.string.target_0307, 
					"07");
			addMenu(R.string.target_0308, 
					"08");
		}else if(category.equals(Category.PRIZE)){
			addMenu(R.string.prize_0401, 
					"01");
			addMenu(R.string.prize_0402, 
					"02");
			addMenu(R.string.prize_0403, 
					"03");
			addMenu(R.string.prize_0404, 
					"04");
		}else if(category.equals(Category.BENEFITS)){
			addMenu(R.string.benefits_0501, 
					"01");
			addMenu(R.string.benefits_0502, 
					"02");
			addMenu(R.string.benefits_0504, 
					"04");
			addMenu(R.string.benefits_0506, 
					"06");
			addMenu(R.string.benefits_0507, 
					"07");
		}
		
		return mSubcategoryItemList;
	}
	
	
	private void addMenu(int name, String id) {

		SubcategoryItem subCategoryItem = new SubcategoryItem();
		subCategoryItem.setCategory(mCategory);
		subCategoryItem.setName(mContext.getString(name));
		subCategoryItem.setId(id);

		mSubcategoryItemList.add(subCategoryItem);
	}
}
